package com.keur.money.http

import com.keur.money.utils.okhttp.callback.StringCallback
import com.keur.money.utils.okhttp.model.HttpParams
import org.json.JSONObject

/**
 * MullaFlow
 * @Author wwdeng
 * @CreateTime: 2024/7/24 17:38
 * @Annotation：网络请求帮助类
 */
object HttpHelper : IHttpLoader {

    private var mHttpLoader: IHttpLoader? = null

    fun init(httpLoader: IHttpLoader) {
        mHttpLoader = httpLoader
    }

    override fun gKeurAction(url: String, params: HttpParams, callback: IHttpCallback) {
        mHttpLoader?.gKeurAction(url, params, callback);
    }

    override fun postKeurAction(url: String, params: JSONObject, callback: IHttpCallback) {
        mHttpLoader?.postKeurAction(url, params, callback);
    }

    override fun postKeurEventAction(url: String, params: JSONObject, callback: IHttpCallback) {
        mHttpLoader?.postKeurEventAction(url, params, callback);
    }

    override fun addKeurEventAction(eventName: String, remark: String) {
        mHttpLoader?.addKeurEventAction(eventName, remark)
    }

    override fun uploadKeurFileAction(httpUrl: String, filePath: String, callback: StringCallback) {
        mHttpLoader?.uploadKeurFileAction(httpUrl,filePath,callback)
    }

    override fun uploadKeurFileAction(httpUrl: String, filePath: String, callback: IHttpCallback) {
        mHttpLoader?.uploadKeurFileAction(httpUrl,filePath,callback)
    }
}
